<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <title>Show</title>
</head>

<body>
    <?php
    //1.建立数据库连接
    include "conn.php";

    //2.接受欲修改的留言id
    $id = $_GET['id'];

    //3.从数据库中读取对应留言
    $sql = "select * from `message` where `id` = $id";

    $result = $conn->query($sql);
    $row = $result->fetch_array();
    ?>

    <!--4.将该留言显示在表单里，便于进一步编辑-->
    <form method="post" action="update.php">
        <fieldset>
            <legend>留言</legend>
            <label>标题</label>
            <input type="text" name="title" value="<?php echo $row['title']; ?>">
            <input type="hidden" name="id" value="<?php echo $row['id']; ?>">
            <br>
            <label>昵称</label>
            <input type="text" name="author" value="<?php echo $row['author']; ?>">
            <br>
            <label>留言</label>
            <textarea name="content" rows="10" cols="25"><?php echo $row['content']; ?></textarea>
            <br>
            <input type="submit" name="sub">
        </fieldset>
    </form>
</body>

</html>